package com.fan.leetcode;

/**
 * 168. Excel表列名称
 *
 * @author ZhangFan
 * @since 2021/8/3 下午 10:15
 */
public class Question168 {
    public String convertToTitle(int columnNumber) {
        int num = columnNumber % 26;
        char c = num == 0 ? 'Z' : (char) (num + '@');
        int flag = (columnNumber - 1) / 26;
        if (flag > 0) {
            return convertToTitle(flag) + c;
        }
        return c + "";
    }
}
